# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.

from odoo import api, fields, models, _
import time


def bmx_ocr_method(fapiao):
    print('bmx_ocr_method', fapiao)
    time.sleep(3)
    result = [{'id': one.id,
               'state': 'done',
               # todo, 其他字段的 模拟值
               } for one in fapiao]
    return result


class FapiaoOcrProvider(models.Model):
    _inherit = "fp.ocr.provider"

    def _request_methods(self):
        result = super()._request_methods()
        result2 = result.copy()
        result2.update({'bmx': bmx_ocr_method})
        return result2
